package com.xxxx.myproject.controller;

import com.xxxx.myproject.entity.Bo.LoginUserBo;
import com.xxxx.myproject.entity.R;
import com.xxxx.myproject.entity.User;
import com.xxxx.myproject.service.LoginService;
import jakarta.annotation.Resource;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;


@RestController
@RequestMapping("/user")
public class LoginController {

    @Resource
    private LoginService loginServcie;

    @PostMapping("/login")
    public R<HashMap<Object,Object>> login(@RequestBody LoginUserBo userBo){
        return R.ok(loginServcie.login(userBo));
    }

    @PostMapping("/user/logout")
    public R<Void> logout(){
        System.out.println("开始登出");
        loginServcie.logout();
        return R.ok();
    }
}
